package cn.xorange.commons.utils.thirdApp.entity;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author yangjian
 */
public class BaseWx implements Serializable {

    private Integer errcode;
    private String errmsg;
    private Watermark watermark;

    public void setErrcode(Integer errcode) {
        this.errcode = errcode;
    }
    public Integer getErrCode(){
        return this.errcode;
    }

    public void setErrmsg(String errmsg) {
        this.errmsg = errmsg;
    }
    public String getErrMsg() {
        if(Objects.nonNull(this.errcode)){
            for(WxErrorCode errorCode : WxErrorCode.values()){
                if(errorCode.getCode().equals(this.errcode)){
                    return errorCode.getMsg();
                }
            }
        }
        if(Objects.isNull(this.errmsg)){
            return "微信接口调用失败";
        }else {
            return this.errmsg;
        }
    }

    public void setWatermark(Watermark watermark) {
        this.watermark = watermark;
    }
    public Watermark getWaterMark(){
        return this.watermark;
    }
}
